<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Upload Class - Configuration - Fuel Documentation</title>
	<link href="../../assets/css/main.css" media="screen" rel="stylesheet" />
	<script type="text/javascript" src="../../assets/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="../../assets/js/nav.js"></script>
	<script type="text/javascript" src="../../assets/js/highlight.pack.js"></script>
	<script type="text/javascript">
		$(function() {
			show_nav('classes', '../../');
		});
		hljs.tabReplace = '    ';
		hljs.initHighlightingOnLoad();
	</script>
</head>
<body>

	<header>
		<h1>Fuel Documentation</h1>
	</header>

	<div id="main-nav"></div>

	<section id="content">
		<h2>Upload Class</h2>

		<p>The upload class allows to securely process files that have been uploaded to the application.
			It allows you to filter uploads in various ways, define what the destination filenames should look like, or filter on size or length of the filename.</p>

		<section>
			<h2>Configuration</h2>

			<p>The upload class is configured through the <kbd>fuel/core/config/upload.php</kbd> configuration file. It is already populated with a default configuration. You can override this configuration by copying this config file to your application config directory, and modify that file as needed.</p>
			<p>The following configuration settings can be defined:</p>
			<table class="config">
				<tbody>
					<tr class="header">
						<th>Param</th>
						<th>Type</th>
						<th>Default</th>
						<th>Description</th>
					</tr>
					<tr>
						<th>auto_process</th>
						<td>boolean</td>
						<td><pre class="php"><code>true</code></pre></td>
						<td>
							If true, the uploaded files will be validated using the configuration stored in the config file as soon as you use the Upload class.
						</td>
					</tr>
					<tr>
						<th>max_size</th>
						<td>integer</td>
						<td><pre class="php"><code>0</code></pre></td>
						<td>
							The maximum size in bytes for every file uploaded. To disable the maximum size limit, set this parameter to zero.
						</td>
					</tr>
					<tr>
						<th>ext_whitelist</th>
						<td>array</td>
						<td><pre class="php"><code>array()</code></pre></td>
						<td>
							Array of allowed file extensions. If empty or not defined, all file extensions are allowed.
						</td>
					</tr>
					<tr>
						<th>ext_blacklist</th>
						<td>array</td>
						<td><pre class="php"><code>array()</code></pre></td>
						<td>
							Array of disallowed file extensions. If empty or not defined, all file extensions are allowed.
						</td>
					</tr>
					<tr>
						<th>type_whitelist</th>
						<td>array</td>
						<td><pre class="php"><code>array()</code></pre></td>
						<td>
							Array of allowed file types. If empty or not defined, all file types are allowed.
							A file type is the part of the file's mimetype before the slash. So if the mimetype is "text/plain", add "text" to this array to allow files of this type.
						</td>
					</tr>
					<tr>
						<th>type_blacklist</th>
						<td>array</td>
						<td><pre class="php"><code>array()</code></pre></td>
						<td>
							array of disallowed file extensions. If empty or not defined, all file extensions are allowed.
						</td>
					</tr>
					<tr>
						<th>mime_whitelist</th>
						<td>array</td>
						<td><pre class="php"><code>array()</code></pre></td>
						<td>
							Array of allowed file mimetypes. If empty or not defined, all mimetypes are allowed.
						</td>
					</tr>
					<tr>
						<th>mime_blacklist</th>
						<td>array</td>
						<td><pre class="php"><code>array()</code></pre></td>
						<td>
							Array of disallowed file mimetypes. If empty or not defined, all mimetypes are allowed.
						</td>
					</tr>
					<tr>
						<th>prefix</th>
						<td>string</td>
						<td><pre class="php"><code>''</code></pre></td>
						<td>
							When you save an uploaded file, the filename will be prefixed with this string.
						</td>
					</tr>
					<tr>
						<th>suffix</th>
						<td>string</td>
						<td><pre class="php"><code>''</code></pre></td>
						<td>
							When you save an uploaded file, the filename will be suffixed with this string.
						</td>
					</tr>
					<tr>
						<th>extension</th>
						<td>string</td>
						<td><pre class="php"><code>''</code></pre></td>
						<td>
							When you save an uploaded file, the filename's extension will be replaced with this string.
						</td>
					</tr>
					<tr>
						<th>path</th>
						<td>string</td>
						<td><pre class="php"><code>''</code></pre></td>
						<td>
							Path to save the uploaded files to.
						</td>
					</tr>
					<tr>
						<th>create_path</th>
						<td>boolean</td>
						<td><pre class="php"><code>true</code></pre></td>
						<td>
							If true, the path defined will be created if it doesn't exist.
							The Upload class supports recursive directory creation, so if the permissions are set properly, any path can be created.
						</td>
					</tr>
					<tr>
						<th>path_chmod</th>
						<td>integer</td>
						<td><pre class="php"><code>0777</code></pre></td>
						<td>
							Permissions to be set on the path after it has been created. This value has to be defined in octal notation, with a leading zero.
						</td>
					</tr>
					<tr>
						<th>file_chmod</th>
						<td>integer</td>
						<td><pre class="php"><code>0666</code></pre></td>
						<td>
							Permissions to be set on the uploaded file after it has been saved to the path defined. This value has to be defined in octal notation, with a leading zero.
						</td>
					</tr>
					<tr>
						<th>auto_rename</th>
						<td>boolean</td>
						<td><pre class="php"><code>true</code></pre></td>
						<td>
							If true, the filename will be suffixed with a sequence number in case the file already exists in the path specified. The sequence number will be the next available number, starting with 1.
						</td>
					</tr>
					<tr>
						<th>overwrite</th>
						<td>boolean</td>
						<td><pre class="php"><code>false</code></pre></td>
						<td>
							If true, the file will be overwritten when saved in case it already exists. This setting will be ignored if 'auto_rename' is true.
						</td>
					</tr>
					<tr>
						<th>randomize</th>
						<td>boolean</td>
						<td><pre class="php"><code>false</code></pre></td>
						<td>
							If true, the file will be assigned a random 32-character name (an MD5 string) when saved. Other settings will still be applied.
						</td>
					</tr>
					<tr>
						<th>normalize</th>
						<td>boolean</td>
						<td><pre class="php"><code>false</code></pre></td>
						<td>
							If true, the filename will be converted to an ASCII name, and all spaces replaced by underscores, when saved.
						</td>
					</tr>
					<tr>
						<th>max_length</th>
						<td>integer</td>
						<td><pre class="php"><code>0</code></pre></td>
						<td>
							The maximum length of a filename. This is measured on the filename as it will be saved, after all filename options have been processed. To disable the maximum size limit, set this parameter to zero.
						</td>
					</tr>
				</tbody>
			</table>
		</section>

	</section>

	<section id="footer">
		<p>
			<a href="http://fuelphp.com">Fuel</a> is released under the MIT license.<br />
			&copy; 2010 - 2011 Fuel Development Team
		</p>
	</section>

</body>
</html>
